package com.cxm.weilai.controller;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: weilai-cloud
 * @description: 定位平台
 * @author: ChenMan
 * @create: 2019-03-26 15:36
 */
@RestController
@RequestMapping(value = "location",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class LocationController {

  @Value("${server.port}")
  private String port;

//  @Autowired
//  RestTemplate restTemplate;

  @GetMapping(value = "init")
  public List findUserInfoList(){
    List list = new ArrayList();
    list.add("alex");
    list.add("lilei");
    list.add(port);
    return list;
  }



  @RequestMapping("/hi")
//  @HystrixCommand(fallbackMethodName = "hiError")
  public String hi(@RequestParam("name") String name){
    return name + port;
//    return restTemplate.getForObject("http://USERINFO-SERVICE/user/findUserInfoList", String.class);
  }

    String hiError(){
        return "错误";
    }

}
